execute if score game_run system matches 1 as @a at @s if score @s Death matches 1.. run gamemode spectator @s
execute if score game_run system matches 1 as @a at @s if score @s Death matches 1.. run tag @s add isDeath
execute if score game_run system matches 1 as @a at @s if score @s Death matches 1.. store result score @s SpawnTime run function vs:system/game/rules/get_value {index:{id:"spawn_time"}}
execute if score game_run system matches 1 as @a at @s if score @s Death matches 1.. run attribute @s generic.armor modifier remove armor_overclock_module:remove_armor
execute if score game_run system matches 1 as @a at @s if score @s Death matches 1.. run scoreboard players reset @s TimeToTick
execute if score game_run system matches 1 as @a at @s if score @s Death matches 1.. run execute if entity @s[team=red] run tp @s @e[type=marker,tag=redSpawn,limit=1]
execute if score game_run system matches 1 as @a at @s if score @s Death matches 1.. run execute if entity @s[team=blue] run tp @s @e[type=marker,tag=blueSpawn,limit=1]

execute if score game_run system matches 1 as @a[tag=isDeath] at @s if score @s Death matches 1.. run scoreboard players reset @s Death

execute if score game_run system matches 1 as @a[tag=isDeath] at @s run scoreboard players add @s TimeToTick 1
execute if score game_run system matches 1 as @a at @s if score @s TimeToTick matches 20.. run scoreboard players remove @s SpawnTime 1
execute if score game_run system matches 1 as @a at @s if score @s TimeToTick matches 20.. run scoreboard players reset @s TimeToTick

execute if score game_run system matches 1 as @a[tag=isDeath] at @s if score @s SpawnTime matches 0.. run title @s actionbar [{"text":"复活剩余","color":"green"},{"score":{"name":"*","objective":"SpawnTime"},"color":"red"},{"text":"秒...","color":"green"}]

execute if score game_run system matches 1 as @a[tag=isDeath,team=red] at @s if score @s SpawnTime matches 0.. unless entity @a[distance=..1,gamemode=!spectator] run spectate @r[gamemode=!spectator,team=red]
execute if score game_run system matches 1 as @a[tag=isDeath,team=blue] at @s if score @s SpawnTime matches 0.. unless entity @a[distance=..1,gamemode=!spectator] run spectate @r[gamemode=!spectator,team=blue]

execute if score game_run system matches 1 as @a[tag=isDeath] at @s if score @s SpawnTime matches ..0 run function vs:system/game/player_start
execute if score game_run system matches 1 as @a[tag=isDeath] at @s if score @s SpawnTime matches ..0 run tag @s remove isDeath

execute if score game_run system matches 1 as @a[tag=isDeath,tag=dieByDevour] at @s run function vs:system/game_ctrol/player/death_devour